# Copyright (c) 2018 Presto Labs Pte. Ltd.
# Author: jhkim

from coin.strategy.mm.base.feed_arb_base import (FeedArbSubscriberHandler, FeedArbSubsystem)
from coin.strategy.mm.subscription import SubscriptionRequest

from coin.exchange.okex_futures.ws.subscriber import OkexFuturesSubscriber
from coin.exchange.okex_futures_v3.ws.subscriber import OkexFuturesSubscriber \
    as OkexFuturesV3Subscriber
from coin.strategy.mm.feed_arb import (OkexFuturesFeedArbFlowBookBuilder,
                                       OkexFuturesV3FeedArbFlowBookBuilder)


class OkexFuturesFeedArbSubscriberHandler(FeedArbSubscriberHandler):
  SubscriberType = OkexFuturesSubscriber


class OkexFuturesFeedArbSubsystem(FeedArbSubsystem):
  FlowBookBuilder = OkexFuturesFeedArbFlowBookBuilder
  FeedSubscriber = OkexFuturesFeedArbSubscriberHandler
  FeedSubReq = SubscriptionRequest('Futures', 'Okex', 'v1')

  def set_price_limit_error_callback(self, callback):
    self._price_limit_error_callback = callback


class OkexFuturesV3FeedArbSubscriberHandler(FeedArbSubscriberHandler):
  SubscriberType = OkexFuturesV3Subscriber


class OkexFuturesV3FeedArbSubsystem(FeedArbSubsystem):
  FlowBookBuilder = OkexFuturesV3FeedArbFlowBookBuilder
  FeedSubscriber = OkexFuturesV3FeedArbSubscriberHandler
  FeedSubReq = SubscriptionRequest('Futures', 'Okex', 'v3')

  def set_price_limit_error_callback(self, callback):
    self._price_limit_error_callback = callback
